/**
 * @param {string} s
 * @return {string}
 */
var reverseWords = function(s) {
    s = s.split(' ')
    // return s
    let res = ''
    for (let i = 0; i< s.length; i++) {
        res += reverse(s[i]) + ' '

    }
    function reverse(str) {
        let temp = ''
        for (let i = str.length-1; i >= 0; i--) {
            temp += str[i]
        }
        return temp
    }
    return res
};
let s = "Let's take LeetCode contest"
console.log(reverseWords(s))